<!--conf
<sample in_favorites="true">
              <product version="1.5" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               <sampledescription><![CDATA[Sample demonstrates the possibility to sort items in tree.]]></sampledescription></sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title> Smart XML parsing and Sorting</title>
</head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
<body>
	<h1>Smart XML parsing and Sorting</h1>
	<p>Try to sort nodes in the first tree using an appropriate action link.<br/>
    Then drag-and-drop any item from the second tree into the first one, you will see that the dropped item will be set in the ASC order.
    <br>Both trees are loaded in the SmartXMLParsing mode, which allows to operate with huge well-formed trees.</p>    
	<table>
		<tr>
			<td>
				<div id="treeboxbox_tree" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"></div><br>
				<div id="treeboxbox_tree2" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"></div>
			</td>
			<td rowspan="2" style="padding-left:25" valign="top">
				<a href="#" onClick="tree.sortTree(tree.getSelectedItemId(),'ASC',1);">Reorder selected branch (ASC)</a><br>
				<a href="#" onClick="tree.sortTree(tree.getSelectedItemId(),'DES',1);">Reorder selected branch (DES)</a><br>
			</td>
		</tr>
		<tr>
			<td>
			</td>
		</tr>
	</table>


	<script>
function treeDrop(id, target, target_before, tree_source, tree_dest) {
	tree_dest.sortTree(target,'ASC',0);
}

			tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);


			tree.setSkin('dhx_skyblue');
			tree.setImagePath("../../../codebase/imgs/dhxtree_skyblue/");
			tree.enableSmartXMLParsing(true);
			tree.enableCheckBoxes(true);
            tree.enableDragAndDrop(true);
			tree.enableThreeStateCheckboxes(true);
			tree.loadXML("../common/tree3_14_selection_sorting_navigation.xml")
			
			tree.setDropHandler(treeDrop);


			tree2=new dhtmlXTreeObject("treeboxbox_tree2","100%","100%",0);



			tree2.setSkin('dhx_skyblue');
			tree2.setImagePath("../../../codebase/imgs/dhxtree_skyblue/");
			tree2.enableSmartXMLParsing(true);
			tree2.enableCheckBoxes(true);
            tree2.enableDragAndDrop(true);
			tree2.enableThreeStateCheckboxes(true);
		    tree2.loadXML("../common/tree3_14_selection_sorting_navigation.xml")
			
			tree2.setDropHandler(treeDrop);




	</script>


</body>
</html>
